package com.gm.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @Author Administrator
 * @Date 2020/6/12 15:45
 **/
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        //过滤器出生
        System.out.println("过滤器出生");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤器成功拦截非法请求......");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {
        //过滤器死亡
        System.out.println("过滤器死亡");
    }
}
